import {createApp} from 'vue'
import ViewUIPlus from 'view-ui-plus'
import App from './App.vue'
import router from './router'
import store from './store'
import './styles/index.less'
// import './mock'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import axios from "axios"

const app = createApp(App)
app.config.globalProperties.$goPage = function (path) {
    router.push(path)
}

app.config.globalProperties.$success = function (msg) {
    ViewUIPlus.Message.success({
        content: msg,
        duration: 1.5,
        closable: true
    })
}
app.config.globalProperties.error = function (msg) {
    ViewUIPlus.Message.error({
        content: msg,
        duration: 3,
        closable: true
    })
}

// axios.defaults.baseURL = "http://127.0.0.1:5000/home"
axios.defaults.baseURL = "http://127.0.0.1:8000/"

// 请求拦截器
// axios.interceptors.request.use((req) => {
//     req.headers["token"] = localStorage.getItem("token") || ""
//     return req
// })

app.config.globalProperties.$axios = axios


app.use(store)
    .use(router)
    .use(ViewUIPlus)
    .use(ElementPlus)
    .mount('#app')